home *** CD-ROM | disk | FTP | other *** search
- Path: zeke.ebtech.net!news
- From: panderso@ebtech.net (Paul Anderson)
- Newsgroups: comp.lang.c
- Subject: Re: EMM386 Problem - main.c (0/1)
- Date: Wed, 03 Jan 1996 20:12:36 GMT
- Organization: Electro-Byte Technologies
- Message-ID: <4cd3mb$cfo@zeke.ebtech.net>
- References: <4c9o94$640@zeke.ebtech.net> <4cc776$dah@gatekeeper.cng.com>
- NNTP-Posting-Host: line31.ebtech.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- "Ian G. Crozier" <ian_g_crozier@cngp.cng.com> wrote:
-
- >panderso@ebtech.net (Paul Anderson) wrote:
- >>I'm writing a menu program, I don't have much of it done yet, but on
- >>running the exec of what I have done I get EMM386 Exception error #12
- >>or #06. I use Watcom's compiler. I've attached the source.
- >>
-
- >I'm not surprised that you're having problems with your program.
-
- >You've posted NINE messages, none of which give any useful information
- >about your code!!
-
- Uh-ohhhh....... Sorry, mail reader hickup... Some of them where
- supposed to have the source attached, but, I can't change the
- encoding!!! I can just import the source, and here goes:
-
- /*
- A menu prog, I am bored, so, why not put in *MY* bid to take
- the place of MM? Oooohhhh.... Let's see,
- We want lots of configurability. Igor! Bring the config
- files!
- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include "menu.h"
-
- main(int argc, char *argv[])
- {
- int i=1;
- /* Engage command-line parser! */
-
- if (argc == 1) {
- printf("\a\nUuuuhhhhh... Yer supposed to tell me the
- config file name.");
- exit(0);
- }
- /* Okey-dokey, got that down, let's plop up the for loop.*/
- while(0==0) /* Index=2(i.e. second param, first is: menu.exe)
- Up Mr. Index. */
- {
- /* printf("%s", argv[i]);*/
- /* Bug test... */
- /*i=i + 1;*/
- /* We only need the config file name, nothing else. */
- /* Remember, include config file var def in h file. */
- config=fopen(argv[i], "r" );
- if (config == NULL)
- {
- /* Uh-oh... *BIG* problem... */
- printf("\a\nError: Unable to open config file
- %s!", argv[i]);
- printf("\nRead docs for help.");
- exit(1);
- }
- /* Now, let us test the error. */
-
- i=loadcnf(config);
- exit(0); /* Exit prog...*/
-
- }
- /*Let's roast this sucker....*/
- }
-
- atexit()
- {
- fclose(config);
- return 0;
- }
-
- /* Config file data loader. */
-
- int loadcnf(FILE *in)
- {
- char indata[40];
- int tmp;
- /* Struct defed in menu.h... */
- fscanf(in,"%s", &indata);
- if (indata=="ON")
- {
- tmp=1;
- }
- else
- {
- tmp=0;
- }
- /*Parms.Color = tmp;*/
- /*indata="";*/
- fscanf(in, "%s", &indata);
- Parms.EntryOne = indata; /* The beginnings of a long and
- painful process...*/
- /*indata="";*/
- fscanf(in, "%s", &indata);
- Parms.EntryOnePath = indata;
- fscanf(in, "%s", &indata);
- Parms.EntryTwo = indata;
- fscanf(in, "%s", &indata);
- Parms.EntryTwoPath = indata;
- fscanf(in, "%s", &indata);
- Parms.EntryThree = indata;
- fscanf(in, "%s", &indata);
- Parms.EntryThreePath = indata;
- fscanf(in, "%s", &indata);
- Parms.EntryFour = indata;
- fscanf(in, "%s", &indata);
- Parms.EntryFourPath = indata;
- fscanf(in, "%s", &indata);
- Parms.EntryFive = indata;
- fscanf(in, "%s", &indata);
- Parms.EntryFivePath = indata;
- fscanf(in, "%s", &indata);
- Parms.EntrySix = indata;
- fscanf(in, "%s", &indata);
- Parms.EntrySixPath = indata;
- /* YESSSSSSS!!!!! I am *DONE* setting up the config
- reader!!!*/
- return 0;
- }
- And the header file:
-
- /* Filling garbage...*/
- FILE *config;
- struct
- {
- int *Color;
- char *EntryOne;
- char *EntryOnePath;
- char *EntryTwo;
- char *EntryTwoPath;
- char *EntryThree;
- char *EntryThreePath;
- char *EntryFour;
- char *EntryFourPath;
- char *EntryFive;
- char *EntryFivePath;
- char *EntrySix;
- char *EntrySixPath;
- char *RegName;
- } Parms;
-
- int loadcnf(FILE *in);
-
- /*Parms data;*/
-
- Sorry for the mistake!!! TTYL!
-
-
-
-
-
-